<template>
  <div>
    <div class="werapp">
      <h1>首页</h1>
      <div class="box1">
        <a href="javascript:;;" class="box2 q1">
          <p>{{ orderCount }}</p>
          <span><i class="el-icon-lock"></i>用户总数</span>
        </a>
      </div>
      <div class="box1">
        <a href="javascript:;;" class="box2 q2">
          <p>{{ productCount }}</p>
          <span><i class="el-icon-s-fold"></i>商品总数</span>
        </a>
      </div>
      <div class="box1">
        <a href="javascript:;;" class="box2 q3">
          <p>{{ userCount }}</p>
          <span><i class="el-icon-circle-check"></i>订单总数</span>
        </a>
      </div>
    </div>
  </div>
</template>

<script>
import { home } from "../../api/index";
export default {
  data() {
    return {
      orderCount: "",
      productCount: "",
      userCount: "",
    };
  },
  created() {
    this.getData();
  },
  methods: {
    getData() {
      home()
        .then((res) => {
          console.log(res.data);
          this.orderCount = res.data.orderCount;
          this.productCount = res.data.productCount;
          this.userCount = res.data.userCount;
        })
        .catch((err) => {
          console.log(err);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.werapp {
  h1 {
    font-size: 36px;
    padding-bottom: 9px;
    margin: 10px 0 20px;
    padding-left: 15px;
    border-bottom: 1px solid transparent;
  }
  .box1 {
    width: 29%;
    float: left;
    height: 160px;
    padding-right: 15px;
    padding-left: 15px;
    .q1 {
      background: #f0ad4e;
    }
    .q2 {
      background: #5cb85c;
    }
    .q3 {
      background: #337ab7;
    }
    .box2 {
      color: white;
      padding: 20px 0;
      text-align: center;
      display: block;
      opacity: 0.9;
      &:hover {
        opacity: 1;
        text-decoration: none;
        color: #333;
        transform: scale(1.08);
        transition: all 0.3s;
      }
      p {
        font-size: 50px;
        text-align: center;
      }
      span{
        font-size: 20px;
      }
    }
  }
}
</style>